package com.system.orderserver.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    @Bean
    public Queue queue(){
        return new Queue("userserver.test");
    }


    @Bean(name = "orderserver3")
    public Queue queueorder(){
        return new Queue("orderserver3");
    }
 @Bean(name = "orderserverIntegral")
    public Queue orderserverIntegral(){
        return new Queue("orderserverIntegral");
    }

    @Bean(name = "orderserver4")
    public Queue queueorder4(){
        return new Queue("orderserver4");
    }

    @Bean
    FanoutExchange topicExchange(){
        return new FanoutExchange("exchang2");
    }

    @Bean
    Binding binding(@Qualifier("orderserver3") Queue queue,FanoutExchange topicExchange){
        return BindingBuilder.bind(queue).to(topicExchange);
    }

    @Bean
    Binding binding2(@Qualifier("orderserver4") Queue queue,FanoutExchange topicExchange){
        return BindingBuilder.bind(queue).to(topicExchange);
    }
}
